﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using SmartWMS.Common.ResponseOutput;
using SmartWMS.Domain.Base;
using SmartWMS.Domain.BasicsDatum;
using SmartWMS.Domain.BusinessManage;
using SmartWMS.Domain.WarehouseManage;
using SmartWMS.Server.Repository;
using SmartWMS.Server.WarehouseManage.LossReportingServices;
using SmartWMS.Server.WarehouseManage.LossReportingServices.Dto;

namespace SmartWMS.API.Controllers.WarehouseManage
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class LossReportingController : ControllerBase
    {
        private readonly ILossReportingServices _lossReportingServices;

        public LossReportingController(ILossReportingServices lossReportingServices)
        {
            _lossReportingServices = lossReportingServices;
        }


            /// <summary>
            /// 报损列表显示
            /// </summary>
            /// <returns></returns>
            [HttpPost]
            public IActionResult ShowFrmlossAsync(whereDto dto)
            {
                var result = _lossReportingServices.ShowFrmlossAsync(dto);
                return Ok(result.Result);
            }

            /// <summary>
            /// 删除报损信息
            /// </summary>
            /// <param name="id"></param>
            /// <returns></returns>
            [HttpPost]
            public IActionResult DeleteFrmlossAsync(KeyEntity id)
            {
                var resault = _lossReportingServices.DeleteFrmlossAsync(id);
                return Ok(resault.Result);
            }

            /// <summary>
            /// 批量删除报损信息
            /// </summary>
            /// <param name="id"></param>
            /// <returns></returns>
            [HttpPost]
            public IActionResult BatchDelFrmlossAsync(string id)
            {
                var result = _lossReportingServices.BatchDelFrmlossAsync(id);
                return Ok(result.Result);
            }

            /// <summary>
            /// 产品列表显示
            /// </summary>
            /// <returns></returns>
            [HttpPost]
            public IActionResult ShowProductAsync(ProductsDto dto)
            {
                var result = _lossReportingServices.ShowProductAsync(dto);
                return Ok(result.Result);
            }

            /// <summary>
            /// 查看报损信息
            /// </summary>
            /// <param name="dto"></param>
            /// <returns></returns>
            [HttpPost]
            public IActionResult ReverseFrmlossAsync(detailDto dto)
            {
                var result = _lossReportingServices.ReverseFrmlossAsync(dto);
                return Ok(result.Result);
            }
    }
}
